package com.tyut.vo;

import lombok.Getter;

@Getter
public class ResultJson {
    private Integer code;
    private Object content;
    private String message;

    public ResultJson(Integer code, Object content, String message) {
        this.code = code;
        this.content = content;
        this.message = message;
    }

    public static ResultJson getInstance(ResultCode code, Object content, String message){
        return new ResultJson(code.getValue(),content,message);
    }

    public static ResultJson success(Object content , String message){
        return getInstance(ResultCode.SUCCESS ,content , message);
    }

    public static ResultJson success(Object content){
        return success(content,null);
    }


    public static ResultJson failed(Object content , String message){
        return getInstance(ResultCode.FAILED ,content , message);
    }

    public static ResultJson failed(String message){
        return failed(null,message);
    }


    public static ResultJson unlogin(String message){
        return getInstance(ResultCode.NOT_LOGIN ,null , message);
    }
}
